package org.qiyu.live.user.provider;

import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
//import org.qiyu.live.user.constants.UserTagsEnum;
//import org.qiyu.live.user.dto.UserDTO;
import org.qiyu.live.user.provider.service.impl.UserServiceImpl;
import org.qiyu.live.user.provider.service.impl.UserTagServiceImpl;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

//import javax.annotation.Resource;
//import java.util.concurrent.CountDownLatch;

/*
* 用户中台 dubbo服务提供者
*
* */
@SpringBootApplication
@EnableDubbo
@EnableDiscoveryClient
public class UserproviderApplication {
    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(UserproviderApplication.class);
        springApplication.setWebApplicationType(WebApplicationType.NONE);
        springApplication.run(args);

    }

//    @Resource
//    UserTagServiceImpl userTagService;
//    @Resource
//    UserServiceImpl userService;
//
//
//    @Override
//    public void afterPropertiesSet() throws InterruptedException {
//        UserDTO byUserId = userService.getByUserId(10001L);
//        boolean b4 = userService.updateUserInfo(byUserId);

//        boolean b5 = userTagService.containTag(10001L, UserTagsEnum.IS_VIP);
//        boolean b2 = userTagService.setTag(10001L, UserTagsEnum.IS_VIP);
//        boolean b = userTagService.containTag(10001L, UserTagsEnum.IS_VIP);
//        boolean b1 = userTagService.containTag(10001L, UserTagsEnum.IS_VIP);
//        System.out.println("--------------"+b+"   "+b1);
//
//        userTagService.cancelTag(10001L,UserTagsEnum.IS_VIP);
//        boolean bb = userTagService.containTag(10001L, UserTagsEnum.IS_VIP);
//        boolean bv3 = userTagService.containTag(10001L, UserTagsEnum.IS_VIP);
//        System.out.println("--------------"+bb+"   "+bv3);

//
//        Long uid = 1004L;
//        CountDownLatch countDownLatch = new CountDownLatch(1);
//        for (int i = 0; i < 100; i++) {
//            Thread thread = new Thread(new Runnable() {
//                @Override
//                public void run() {
//                    try {
//                        countDownLatch.await();
//                        System.out.println("result ..." + userTagService.setTag(uid,UserTagsEnum.IS_VIP));
//
//                    } catch (InterruptedException e) {
//                        throw new RuntimeException(e);
//                    }
//                }
//            });
//            thread.start();
//        }
//        countDownLatch.countDown();
//        Thread.sleep(100000);


//    }
}
